<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String pageName = request.getParameter("pageName"); %>
<% String context = request.getContextPath(); %>
<script>
  var CONTEXT = "<%=context%>";
</script>
<script type="text/javascript" src="<%=context%>/js/common.js"></script>
<div class="top">
  <div class="topContainer">
    <div class="logoDiv">
      <img src="images/logo.png" id="blogImg" alt="Fiidee Blog"/>
    </div>
    <div class="navDiv">
      <ul>
        <li><a href="<%=context%>/" <%if (pageName.equals("index"))out.write("class='actived'");%>>首页</a></li>
        <li><a href="<%=context%>/search" <%if (pageName.equals("search"))out.write("class='actived'");%>>找人</a></li>
        <c:if test="${userId != null && userId != ''}">
          <li><a href="<%=context%>/home" <%if (pageName.equals("home"))out.write("class='actived'");%>>${name}</a></li>
        </c:if>
      </ul>
    </div>
  </div>
</div>
<div class="menu">
  <div class="menuContainer row">
    <div class="searchBar col-md-3 col-sm-5">
      <div class="input-group ">
        <input type="text" name="search" class="form-control" placeholder="Search for Blog...">
	            <span class="input-group-btn">
	                <button class="btn btn-default search-btn" type="button">
                      <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                    </button>
	            </span>
      </div>
    </div>
    <div class="userinfoBar col-md-9 col-sm-7">
      <c:choose>
        <c:when test='${userId != ""}'>
          <div class="usericon infoBar">
            <img src="images/logout.png" class="logoutAction imgAction" alt=""/>
          </div>
          <div class="usericon infoBar">
            <img src="images/setting.png" class="imgUrl" href="/setting" alt=""/>
          </div>
          <div class="usericon infoBar">
            <img src="images/post.png" class="imgUrl" href="/publish" alt=""/>
          </div>
          <div class="usericon infoBar">
            <c:choose>
              <c:when test='${ "" != avatar && null != avatar}'>
                <img src="${avatar}" alt=""/>
              </c:when>
              <c:otherwise>
                <img src="<%=context%>/images/avatar.jpg"  alt=""/>
              </c:otherwise>
            </c:choose>
          </div>
        </c:when>
        <c:otherwise>
          <div class="usericon infoBar">
            <img src="images/login.png" class="imgAction showLoginBox"  alt=""/>
          </div>
        </c:otherwise>
      </c:choose>

    </div>

  </div>
</div>